package com.imooc.validator;

import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;

public class MyConstraintValidator implements ConstraintValidator<MyConstraint,Object> {

    // 这里可以注入被Spring管理的类或者服务

    @Override
    public void initialize(MyConstraint myConstraint) {
        System.out.println("my validator init ");
    }

    @Override
    public boolean isValid(Object value, ConstraintValidatorContext constraintValidatorContext) {
        System.out.println("value="+value);
        return true;
    }
}
